package converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class StringToDateConverter implements Converter<String, Date> {

	@Override
	public Date convert(String strDate) {
		Date date = null;
		if(strDate!=null){
			SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
			try {
				date = sdf.parse(strDate);
			} catch (ParseException e) {
				//TODO
				System.err.println("invalid date format");
			}
		}
		return date;
	}
}
